//
//  CNShopCarSignTimeView.m
//  BeeQuick_19
//
//  Created by w on 16/9/23.
//  Copyright © 2016年 CN Team. All rights reserved.
//

#import "CNShopCarSignTimeView.h"

@implementation CNShopCarSignTimeView
- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        UILabel *signTimeTitleLable = [[UILabel alloc]init];
        signTimeTitleLable.text = @"收货时间";
        [signTimeTitleLable sizeToFit];
        signTimeTitleLable.font = [UIFont systemFontOfSize:15];
        [self addSubview:signTimeTitleLable];
        
        UILabel *correctTimeLable = [[UILabel alloc]init];
        correctTimeLable.text = @"  闪电送,及时达";
        correctTimeLable.textColor = [UIColor redColor];
        correctTimeLable.font = [UIFont systemFontOfSize:12];
        [correctTimeLable sizeToFit];
        [self addSubview:correctTimeLable];
        
        UIButton *reseveBtn = [[UIButton alloc]init];
        [reseveBtn setTitle:@"可预订" forState:UIControlStateNormal];
        [reseveBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        reseveBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        [reseveBtn addTarget:self action:@selector(orderbuttonClicked) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:reseveBtn];
        
        
        UIImageView *arrowImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_go"]];
        [self addSubview:arrowImageView];
        //使用Masonry进行布局 布局是相对约束
        //signTimeTitleLable  correctTimeLable  reseveBtn arrowImageView
        [signTimeTitleLable mas_makeConstraints:^(MASConstraintMaker *make) {
            //offset 偏移量
            make.leading.equalTo(self).offset(20);
            make.centerY.equalTo(self);
        }];
        [correctTimeLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(signTimeTitleLable.mas_trailing);
            make.centerY.equalTo(self);
        }];
        [arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.trailing.equalTo(self).offset(-10);
            make.centerY.equalTo(self);
        }];
        [reseveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.trailing.equalTo(arrowImageView.mas_leading).offset(-15);
            make.centerY.equalTo(self);
        }];
        
    }
    return self;
}
//添加预定的点击事件
- (void)orderbuttonClicked{
  NSLog(@"我被点击了")
}
@end
